package com.atguigu.desaes;

import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;

import java.security.MessageDigest;

public class DigestDemo1 {
    public static void main(String[] args) throws Exception {
        // 原文
        String input = "aa";
        // 算法
        String algorithm = "SHA-512";
        //MD5
        //SHA-1
        //SHA-256
        // 获取数字摘要对象
        MessageDigest digest = MessageDigest.getInstance(algorithm);
        byte[] digest1 = digest.digest(input.getBytes());
        System.out.println(Base64.encode(digest1));//QSS8CpM1wn8IbyS6IHpJEg==
    }
}
